// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//

#pragma once

#include <cstdint>
#include <string>
#include <cantor/proto/type.pb.h>
#include <turbo/numeric/int128.h>
#include <turbo/times/time.h>

namespace cantor {
    template<class T>
    struct CppTypeToTypeInfo;

    template<>
    struct CppTypeToTypeInfo<bool> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<int8_t> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<int16_t> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<int32_t> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<int64_t> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<turbo::int128> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<uint8_t> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<uint16_t> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<uint32_t> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<uint64_t> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<turbo::uint128> {
        static pb::TypeInfo convert();
    };

    struct Fp8Trait {
    };

    template<>
    struct CppTypeToTypeInfo<Fp8Trait> {
        static pb::TypeInfo convert();
    };

    struct Fp16Trait {
    };

    template<>
    struct CppTypeToTypeInfo<Fp16Trait> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<float> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<double> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<std::string> {
        static pb::TypeInfo convert();
    };

    struct BinaryTrait {
    };

    template<>
    struct CppTypeToTypeInfo<BinaryTrait> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<turbo::Time> {
        static pb::TypeInfo convert();
    };

    template<>
    struct CppTypeToTypeInfo<turbo::Duration> {
        static pb::TypeInfo convert();
    };

    template<typename  ...Types>
    std::vector<pb::TypeInfo> cpp_type_infos() {
        return std::vector<pb::TypeInfo>{CppTypeToTypeInfo<Types>::convert()...};
    }

} // namespace cantor
